$(function(){
  imgSize($(".topic-picture-item"));
  blockImgSize($(".headImg-box"))
  //点赞
  $(".praiseLink").click(function(){
    var iconImg=$(this).find("i")
    var praiseStatus=iconImg.attr("class");
    if(praiseStatus=="icon-praised"){
      iconImg.removeClass("icon-praised");
      iconImg.addClass("icon-praise");
      Alert.tips("取消点赞！");
    }else if(praiseStatus=="icon-praise"){
      iconImg.removeClass("icon-praise");
      iconImg.addClass("icon-praised");
      Alert.tips("点赞成功！");
    }
  });
  //点击评论
})
function blockImgSize(obj){
  obj.each(function(v,k){
    var imgWidth=$(k).width();
    $(k).height(imgWidth)
  })

}
//图片的调整方法
function imgSize (obj) {
  obj.each(function(){
    var imgWidth = $(this).width();
    $(this).height(imgWidth);
    var img=$(this).children();
    var imgItem=new Image();
    imgItem.src=img.attr("src");
    var imgRealWidth=imgItem.width;
    var imgRealHeight=imgItem.height;
    if(imgRealWidth==imgRealHeight){
      img.css("width","100%");
      img.css("height","100%");
    }else if(imgRealWidth>imgRealHeight){
      img.css("height","100%");
    }else if(imgRealWidth<imgRealHeight){
      img.css("width","100%");
    }
  });
};